package com.xiaoxi.bms.service.user;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xiaoxi.bms.common.exception.BMSException;
import com.xiaoxi.bms.domain.user.BMSUser;
import com.xiaoxi.bms.domain.user.vo.BMSUserPasswordChangeVO;
import org.springframework.security.core.userdetails.UserDetailsService;

import java.util.List;
import java.util.Map;

/**
 * @ClassName BMSUserService
 * @Description
 * @Author xiaoxi
 * @Date 2022/4/24 14:26
 * @Version 1.0
 */
public interface BMSUserService extends UserDetailsService, IService<BMSUser> {

    /**
     * 用户登陆
     *
     * @param username 账号
     * @param password 密码
     */
    Map<String, String> userLogin(String username, String password);


    /**
     * 删除用户
     *
     * @param userId
     * @return
     */
    Boolean deleteUserByUserId(Long userId);


    /**
     * 通过 username 查询一个用户
     *
     * @param username
     * @return
     */
    BMSUser selectOneByUserName(String username);

    /**
     * 修改密码
     *
     * @param bmsUserPasswordChangeVO
     * @param checkOldPassword
     * @throws BMSException
     */
    void changePassword(BMSUserPasswordChangeVO bmsUserPasswordChangeVO, Boolean checkOldPassword) throws BMSException;

    /**
     * 初始化 密码
     *
     * @param username
     * @param enable
     * @return
     * @throws BMSException
     */
    BMSUser initPassword(String username, Boolean enable) throws BMSException;


    /**
     * 通过用户编号 查询用户
     *
     * @param userId
     * @return
     */
    BMSUser selectUserById(Long userId);

    /**
     * 修改用户状态
     *
     * @param userId
     * @param enable
     * @return
     */
    Boolean enableUserStatus(Long userId, Boolean enable) throws BMSException;

    /**
     * 修改锁定状态
     *
     * @param userId
     * @param nonLockedUserStatus
     * @return
     */
    Boolean accountNonLockedUserStatus(Long userId, Boolean nonLockedUserStatus) throws BMSException;
}
